home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / vfprintf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-13  |  1.9 KB  |  96 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: vfprintf.c,v 1.4 1996/09/13 17:50:09 digulla Exp $
  4.     $Log: vfprintf.c,v $
  5.     Revision 1.4  1996/09/13 17:50:09  digulla
  6.     Use IPTR
  7.  
  8.     Revision 1.3  1996/08/13 13:52:52  digulla
  9.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  10.     Replaced __AROS_LA by __AROS_LHA
  11.  
  12.     Revision 1.2  1996/08/01 17:40:59  digulla
  13.     Added standard header for all files
  14.  
  15.     Desc:
  16.     Lang: english
  17. */
  18. #include <clib/exec_protos.h>
  19. #include <dos/dosextens.h>
  20. #include <dos/filesystem.h>
  21. #include <clib/dos_protos.h>
  22. #include "dos_intern.h"
  23.  
  24. __RA2(void,vfp_hook,UBYTE,chr,D0,struct vfp*,vfp,A3)
  25. {
  26.     __AROS_FUNC_INIT
  27.     extern struct DosLibrary *DOSBase;
  28.     if(vfp->count>=0)
  29.     {
  30.     if(FPUTC(vfp->file,chr)<0)
  31.     {
  32.         vfp->count=-1;
  33.         return;
  34.     }
  35.     vfp->count++;
  36.     }
  37.     __AROS_FUNC_EXIT
  38. }
  39.  
  40. /*****************************************************************************
  41.  
  42.     NAME */
  43.     #include <clib/dos_protos.h>
  44.  
  45.     __AROS_LH3(LONG, VFPrintf,
  46.  
  47. /*  SYNOPSIS */
  48.     __AROS_LHA(BPTR,   file,     D1),
  49.     __AROS_LHA(STRPTR, format,   D2),
  50.     __AROS_LHA(IPTR *, argarray, D3),
  51.  
  52. /*  LOCATION */
  53.     struct DosLibrary *, DOSBase, 59, Dos)
  54.  
  55. /*  FUNCTION
  56.  
  57.     INPUTS
  58.  
  59.     RESULT
  60.  
  61.     NOTES
  62.  
  63.     EXAMPLE
  64.  
  65.     BUGS
  66.  
  67.     SEE ALSO
  68.  
  69.     INTERNALS
  70.  
  71.     HISTORY
  72.     29-10-95    digulla automatically created from
  73.                 dos_lib.fd and clib/dos_protos.h
  74.  
  75. *****************************************************************************/
  76. {
  77.     __AROS_FUNC_INIT
  78.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  79.  
  80.     struct vfp vfp;
  81.  
  82.     vfp.file=file;
  83.     vfp.count=0;
  84.  
  85.     (void)RawDoFmt(format,argarray,(VOID_FUNC)vfp_hook,&vfp);
  86.  
  87.     /* Remove the last character (which is a NUL character) */
  88.     if(vfp.count>0)
  89.     {
  90.     vfp.count--;
  91.     ((struct FileHandle *)BADDR(file))->fh_Pos--;
  92.     }
  93.     return vfp.count;
  94.     __AROS_FUNC_EXIT
  95. } /* VFPrintf */
  96.